/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author dbohry
 */
@Entity
@Table(name = "PLATAFORMA")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Plataforma.findAll", query = "SELECT p FROM Plataforma p"),
    @NamedQuery(name = "Plataforma.findByPlataformaId", query = "SELECT p FROM Plataforma p WHERE p.plataformaId = :plataformaId"),
    @NamedQuery(name = "Plataforma.findByAtivo", query = "SELECT p FROM Plataforma p WHERE p.ativo = :ativo"),
    @NamedQuery(name = "Plataforma.findByTitulo", query = "SELECT p FROM Plataforma p WHERE p.titulo = :titulo")})
public class Plataforma implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "PLATAFORMA_ID")
    private Long plataformaId;
    @Column(name = "ATIVO")
    private Integer ativo;
    @Size(max = 255)
    @Column(name = "TITULO")
    private String titulo;
    @OneToMany(mappedBy = "plataforma")
    private Collection<Jogo> jogoCollection;

    public Plataforma() {
    }

    public Plataforma(Long plataformaId) {
        this.plataformaId = plataformaId;
    }

    public Long getPlataformaId() {
        return plataformaId;
    }

    public void setPlataformaId(Long plataformaId) {
        this.plataformaId = plataformaId;
    }

    public Integer getAtivo() {
        return ativo;
    }

    public void setAtivo(Integer ativo) {
        this.ativo = ativo;
    }

    public String getTitulo() {
        return titulo;
    }

    public void setTitulo(String titulo) {
        this.titulo = titulo;
    }

    @XmlTransient
    public Collection<Jogo> getJogoCollection() {
        return jogoCollection;
    }

    public void setJogoCollection(Collection<Jogo> jogoCollection) {
        this.jogoCollection = jogoCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (plataformaId != null ? plataformaId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Plataforma)) {
            return false;
        }
        Plataforma other = (Plataforma) object;
        if ((this.plataformaId == null && other.plataformaId != null) || (this.plataformaId != null && !this.plataformaId.equals(other.plataformaId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Plataforma[ plataformaId=" + plataformaId + " ]";
    }
    
}
